{% extends "../base.html" %} 
{% block parent_title %}文章管理 {% endblock %} 
{% block parent_url %}topic{% endblock %}
{% block title %}修改文章{% endblock %}
{% block content %}
<form action="/admin/topic/edit/{{ topic.id }}" method="post">
    <input type="hidden" name="id" value="{{ topic.id }}">
    <div class="form-group">
        <label for="title">标题</label>
        <input type="text" class="form-control" id="title" name="title" placeholder="文章标题" value="{{ topic.title}}" required>
    </div>
    <div class="form-group">
        <label for="subject_id">专题</label>
        <select class="form-control" id="subject_id" name="subject_id" placeholder="专题" required>
            <option value="">--请选择--</option>
            {% for subject in subjects %}
            <option value="{{ subject.id }}" data-slug="{{ subject.slug }}"{%if subject.id == topic.subject_id %} selected{%endif%}>{{ subject.name }}</option>
            {% endfor %}
        </select>
    </div>
    <div class="form-group">
        <label for="slug">固定链接</label>
        <input type="text" class="form-control" id="slug" name="slug" placeholder="固定链接" value="{{ topic.slug }}" required>
    </div>
    <div class="form-group">
        <label for="summary">摘要</label>
        <textarea class="form-control" id="summary" name="summary" placeholder="摘要" rows="3" required>{{topic.summary}}</textarea>
    </div>
    <div class="form-group">
        <label for="src">来源</label>
        <input type="text" class="form-control" id="src" name="src" placeholder="来源" value="{{ topic.src }}" required>
    </div>
    <div class="form-group">
        <label for="author">作者</label>
        <input type="text" class="form-control" id="author" name="author" placeholder="作者" value="{{ topic.author }}" required>
    </div>
    <div class="form-group">
        <label for="md">内容</label>
        <textarea class="form-control" id="md" name="md" placeholder="内容" rows="15" required>{{ topic.md }}</textarea>
    </div>
    <div class="form-group">
        <label for="tags">标签</label>
        <input type="text" class="form-control" id="tags" name="tags" value="{{ topic.tags() }}" placeholder="标签" required>
    </div>
    <button type="submit" class="btn btn-primary">提交</button>
</form>
{% endblock %}
